package com.main;

import com.beans.PersonBean;
import creator.ui.controller.ReadData;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ReadScores {

  public static void main(String[] args) {
    ArrayList persons = (ArrayList) ReadData.ReadObjectFromLocal("Scores.dat");

    List peps = persons;
    Collections.sort(peps, new SortByScores());
    for (PersonBean p : peps) {
      System.out.println("时间: " + p.time + "\t分数: " + p.scores);
    }

    ArrayList ScoresList = new ArrayList();
    int i = 0;
    int sp = 5;
    int sp2 = 15;
    for (PersonBean pb : peps) {
      i++;
      String id = i + ".";
      for (int j = id.length(); j <= sp; j++) {
        id = id + " ";
      }
      String time = pb.time;
      for (int j = time.length(); j <= sp2; j++) {
        time = time + " ";
      }
      ScoresList.add(id + time + pb.scores);
    }

    for (String str : ScoresList) System.out.println(str);
  }
}
